/**
 * @FileName: VnetService.java
 * @Author
 * @Description:
 * @Date 2016年9月1日 上午10:52:37
 * @CopyRight ZTE Corporation
 */
package cn.hpclub.server.service;

import cn.hpclub.server.constant.Constant;
import cn.hpclub.server.model.TariffClassRelation;
import cn.hpclub.server.util.InterfaceUtil;
import com.jfinal.plugin.activerecord.Db;
import org.quartz.core.QuartzScheduler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;

public class TariffClassRelationService {
    private static final Logger      logger  = LoggerFactory.getLogger(QuartzScheduler.class);
    public static TariffClassRelationService service = new TariffClassRelationService();


    public int deleteRelationByTariffId(int tariffId){
        String sql = "DELETE FROM tariff_class_relation WHERE tariff_id = ?";
        int number = Db.update(sql,tariffId);
        return number;
    }


    public void saveRelation(int tariffId,List<Integer> tariffClassIdList){
        for (Integer tariffClassId : tariffClassIdList) {
            TariffClassRelation tariffClassRelation = new TariffClassRelation();
            tariffClassRelation.set(TariffClassRelation.TARIFF_ID,tariffId);
            tariffClassRelation.set(TariffClassRelation.TARIFF_CLASS_ID,tariffClassId);
            tariffClassRelation.save();
        }
    }





}
